#include <algorithm>

int triangleType(int a, int b, int c)
{
    enum ERet{
        scalene = 1,
        isosceles = 2,
        equilateral = 3,
        error = 4
    };
    if(a <= 0 || b <= 0 || c <= 0)
        return error;
    if(a == b && a == c)
        return equilateral;
    //sort a >= b >= c
    if(a < b)
        std::swap(a, b);
    if(a < c)
        std::swap(a, c);
    if(b < c) 
        std::swap(b, c);
    if(a - b >= c)
        return error;
    if(a == b || b == c)
        return isosceles;
    return scalene;
}

#include <iostream>

//generate test cases
void genTests()
{
    //test case
    for(int a = -1;a <= 4; ++a)
        for(int b = -1;b <= 4; ++b)
            for(int c = -1;c <= 4; ++c){
                std::cout<<"{"<<a<<", "<<b<<", "<<c<<", "
                    <<triangleType(a, b, c)<<"},\n";
            }
    const int kMax = 0x7FFFFFFF;
    for(int a = -2;a <= 1; ++a)
        for(int b = -2;b <= 1; ++b)
            for(int c = -2;c <= 1; ++c){
                std::cout<<std::hex<<"{0x"<<(a + kMax)<<", 0x"<<(b + kMax)<<", 0x"<<(c + kMax)<<", "
                    <<triangleType(a + kMax, b + kMax, c + kMax)<<"},\n";
            }
}

int main()
{
    //genTests();
    const int kTestCase[][4] = {    //generated by genTests()
        {-1, -1, -1, 4},
        {-1, -1, 0, 4},
        {-1, -1, 1, 4},
        {-1, -1, 2, 4},
        {-1, -1, 3, 4},
        {-1, -1, 4, 4},
        {-1, 0, -1, 4},
        {-1, 0, 0, 4},
        {-1, 0, 1, 4},
        {-1, 0, 2, 4},
        {-1, 0, 3, 4},
        {-1, 0, 4, 4},
        {-1, 1, -1, 4},
        {-1, 1, 0, 4},
        {-1, 1, 1, 4},
        {-1, 1, 2, 4},
        {-1, 1, 3, 4},
        {-1, 1, 4, 4},
        {-1, 2, -1, 4},
        {-1, 2, 0, 4},
        {-1, 2, 1, 4},
        {-1, 2, 2, 4},
        {-1, 2, 3, 4},
        {-1, 2, 4, 4},
        {-1, 3, -1, 4},
        {-1, 3, 0, 4},
        {-1, 3, 1, 4},
        {-1, 3, 2, 4},
        {-1, 3, 3, 4},
        {-1, 3, 4, 4},
        {-1, 4, -1, 4},
        {-1, 4, 0, 4},
        {-1, 4, 1, 4},
        {-1, 4, 2, 4},
        {-1, 4, 3, 4},
        {-1, 4, 4, 4},
        {0, -1, -1, 4},
        {0, -1, 0, 4},
        {0, -1, 1, 4},
        {0, -1, 2, 4},
        {0, -1, 3, 4},
        {0, -1, 4, 4},
        {0, 0, -1, 4},
        {0, 0, 0, 4},
        {0, 0, 1, 4},
        {0, 0, 2, 4},
        {0, 0, 3, 4},
        {0, 0, 4, 4},
        {0, 1, -1, 4},
        {0, 1, 0, 4},
        {0, 1, 1, 4},
        {0, 1, 2, 4},
        {0, 1, 3, 4},
        {0, 1, 4, 4},
        {0, 2, -1, 4},
        {0, 2, 0, 4},
        {0, 2, 1, 4},
        {0, 2, 2, 4},
        {0, 2, 3, 4},
        {0, 2, 4, 4},
        {0, 3, -1, 4},
        {0, 3, 0, 4},
        {0, 3, 1, 4},
        {0, 3, 2, 4},
        {0, 3, 3, 4},
        {0, 3, 4, 4},
        {0, 4, -1, 4},
        {0, 4, 0, 4},
        {0, 4, 1, 4},
        {0, 4, 2, 4},
        {0, 4, 3, 4},
        {0, 4, 4, 4},
        {1, -1, -1, 4},
        {1, -1, 0, 4},
        {1, -1, 1, 4},
        {1, -1, 2, 4},
        {1, -1, 3, 4},
        {1, -1, 4, 4},
        {1, 0, -1, 4},
        {1, 0, 0, 4},
        {1, 0, 1, 4},
        {1, 0, 2, 4},
        {1, 0, 3, 4},
        {1, 0, 4, 4},
        {1, 1, -1, 4},
        {1, 1, 0, 4},
        {1, 1, 1, 3},
        {1, 1, 2, 4},
        {1, 1, 3, 4},
        {1, 1, 4, 4},
        {1, 2, -1, 4},
        {1, 2, 0, 4},
        {1, 2, 1, 4},
        {1, 2, 2, 2},
        {1, 2, 3, 4},
        {1, 2, 4, 4},
        {1, 3, -1, 4},
        {1, 3, 0, 4},
        {1, 3, 1, 4},
        {1, 3, 2, 4},
        {1, 3, 3, 2},
        {1, 3, 4, 4},
        {1, 4, -1, 4},
        {1, 4, 0, 4},
        {1, 4, 1, 4},
        {1, 4, 2, 4},
        {1, 4, 3, 4},
        {1, 4, 4, 2},
        {2, -1, -1, 4},
        {2, -1, 0, 4},
        {2, -1, 1, 4},
        {2, -1, 2, 4},
        {2, -1, 3, 4},
        {2, -1, 4, 4},
        {2, 0, -1, 4},
        {2, 0, 0, 4},
        {2, 0, 1, 4},
        {2, 0, 2, 4},
        {2, 0, 3, 4},
        {2, 0, 4, 4},
        {2, 1, -1, 4},
        {2, 1, 0, 4},
        {2, 1, 1, 4},
        {2, 1, 2, 2},
        {2, 1, 3, 4},
        {2, 1, 4, 4},
        {2, 2, -1, 4},
        {2, 2, 0, 4},
        {2, 2, 1, 2},
        {2, 2, 2, 3},
        {2, 2, 3, 2},
        {2, 2, 4, 4},
        {2, 3, -1, 4},
        {2, 3, 0, 4},
        {2, 3, 1, 4},
        {2, 3, 2, 2},
        {2, 3, 3, 2},
        {2, 3, 4, 1},
        {2, 4, -1, 4},
        {2, 4, 0, 4},
        {2, 4, 1, 4},
        {2, 4, 2, 4},
        {2, 4, 3, 1},
        {2, 4, 4, 2},
        {3, -1, -1, 4},
        {3, -1, 0, 4},
        {3, -1, 1, 4},
        {3, -1, 2, 4},
        {3, -1, 3, 4},
        {3, -1, 4, 4},
        {3, 0, -1, 4},
        {3, 0, 0, 4},
        {3, 0, 1, 4},
        {3, 0, 2, 4},
        {3, 0, 3, 4},
        {3, 0, 4, 4},
        {3, 1, -1, 4},
        {3, 1, 0, 4},
        {3, 1, 1, 4},
        {3, 1, 2, 4},
        {3, 1, 3, 2},
        {3, 1, 4, 4},
        {3, 2, -1, 4},
        {3, 2, 0, 4},
        {3, 2, 1, 4},
        {3, 2, 2, 2},
        {3, 2, 3, 2},
        {3, 2, 4, 1},
        {3, 3, -1, 4},
        {3, 3, 0, 4},
        {3, 3, 1, 2},
        {3, 3, 2, 2},
        {3, 3, 3, 3},
        {3, 3, 4, 2},
        {3, 4, -1, 4},
        {3, 4, 0, 4},
        {3, 4, 1, 4},
        {3, 4, 2, 1},
        {3, 4, 3, 2},
        {3, 4, 4, 2},
        {4, -1, -1, 4},
        {4, -1, 0, 4},
        {4, -1, 1, 4},
        {4, -1, 2, 4},
        {4, -1, 3, 4},
        {4, -1, 4, 4},
        {4, 0, -1, 4},
        {4, 0, 0, 4},
        {4, 0, 1, 4},
        {4, 0, 2, 4},
        {4, 0, 3, 4},
        {4, 0, 4, 4},
        {4, 1, -1, 4},
        {4, 1, 0, 4},
        {4, 1, 1, 4},
        {4, 1, 2, 4},
        {4, 1, 3, 4},
        {4, 1, 4, 2},
        {4, 2, -1, 4},
        {4, 2, 0, 4},
        {4, 2, 1, 4},
        {4, 2, 2, 4},
        {4, 2, 3, 1},
        {4, 2, 4, 2},
        {4, 3, -1, 4},
        {4, 3, 0, 4},
        {4, 3, 1, 4},
        {4, 3, 2, 1},
        {4, 3, 3, 2},
        {4, 3, 4, 2},
        {4, 4, -1, 4},
        {4, 4, 0, 4},
        {4, 4, 1, 2},
        {4, 4, 2, 2},
        {4, 4, 3, 2},
        {4, 4, 4, 3},
        {0x7ffffffd, 0x7ffffffd, 0x7ffffffd, 3},
        {0x7ffffffd, 0x7ffffffd, 0x7ffffffe, 2},
        {0x7ffffffd, 0x7ffffffd, 0x7fffffff, 2},
        {0x7ffffffd, 0x7ffffffd, 0x80000000, 4},
        {0x7ffffffd, 0x7ffffffe, 0x7ffffffd, 2},
        {0x7ffffffd, 0x7ffffffe, 0x7ffffffe, 2},
        {0x7ffffffd, 0x7ffffffe, 0x7fffffff, 1},
        {0x7ffffffd, 0x7ffffffe, 0x80000000, 4},
        {0x7ffffffd, 0x7fffffff, 0x7ffffffd, 2},
        {0x7ffffffd, 0x7fffffff, 0x7ffffffe, 1},
        {0x7ffffffd, 0x7fffffff, 0x7fffffff, 2},
        {0x7ffffffd, 0x7fffffff, 0x80000000, 4},
        {0x7ffffffd, 0x80000000, 0x7ffffffd, 4},
        {0x7ffffffd, 0x80000000, 0x7ffffffe, 4},
        {0x7ffffffd, 0x80000000, 0x7fffffff, 4},
        {0x7ffffffd, 0x80000000, 0x80000000, 4},
        {0x7ffffffe, 0x7ffffffd, 0x7ffffffd, 2},
        {0x7ffffffe, 0x7ffffffd, 0x7ffffffe, 2},
        {0x7ffffffe, 0x7ffffffd, 0x7fffffff, 1},
        {0x7ffffffe, 0x7ffffffd, 0x80000000, 4},
        {0x7ffffffe, 0x7ffffffe, 0x7ffffffd, 2},
        {0x7ffffffe, 0x7ffffffe, 0x7ffffffe, 3},
        {0x7ffffffe, 0x7ffffffe, 0x7fffffff, 2},
        {0x7ffffffe, 0x7ffffffe, 0x80000000, 4},
        {0x7ffffffe, 0x7fffffff, 0x7ffffffd, 1},
        {0x7ffffffe, 0x7fffffff, 0x7ffffffe, 2},
        {0x7ffffffe, 0x7fffffff, 0x7fffffff, 2},
        {0x7ffffffe, 0x7fffffff, 0x80000000, 4},
        {0x7ffffffe, 0x80000000, 0x7ffffffd, 4},
        {0x7ffffffe, 0x80000000, 0x7ffffffe, 4},
        {0x7ffffffe, 0x80000000, 0x7fffffff, 4},
        {0x7ffffffe, 0x80000000, 0x80000000, 4},
        {0x7fffffff, 0x7ffffffd, 0x7ffffffd, 2},
        {0x7fffffff, 0x7ffffffd, 0x7ffffffe, 1},
        {0x7fffffff, 0x7ffffffd, 0x7fffffff, 2},
        {0x7fffffff, 0x7ffffffd, 0x80000000, 4},
        {0x7fffffff, 0x7ffffffe, 0x7ffffffd, 1},
        {0x7fffffff, 0x7ffffffe, 0x7ffffffe, 2},
        {0x7fffffff, 0x7ffffffe, 0x7fffffff, 2},
        {0x7fffffff, 0x7ffffffe, 0x80000000, 4},
        {0x7fffffff, 0x7fffffff, 0x7ffffffd, 2},
        {0x7fffffff, 0x7fffffff, 0x7ffffffe, 2},
        {0x7fffffff, 0x7fffffff, 0x7fffffff, 3},
        {0x7fffffff, 0x7fffffff, 0x80000000, 4},
        {0x7fffffff, 0x80000000, 0x7ffffffd, 4},
        {0x7fffffff, 0x80000000, 0x7ffffffe, 4},
        {0x7fffffff, 0x80000000, 0x7fffffff, 4},
        {0x7fffffff, 0x80000000, 0x80000000, 4},
        {0x80000000, 0x7ffffffd, 0x7ffffffd, 4},
        {0x80000000, 0x7ffffffd, 0x7ffffffe, 4},
        {0x80000000, 0x7ffffffd, 0x7fffffff, 4},
        {0x80000000, 0x7ffffffd, 0x80000000, 4},
        {0x80000000, 0x7ffffffe, 0x7ffffffd, 4},
        {0x80000000, 0x7ffffffe, 0x7ffffffe, 4},
        {0x80000000, 0x7ffffffe, 0x7fffffff, 4},
        {0x80000000, 0x7ffffffe, 0x80000000, 4},
        {0x80000000, 0x7fffffff, 0x7ffffffd, 4},
        {0x80000000, 0x7fffffff, 0x7ffffffe, 4},
        {0x80000000, 0x7fffffff, 0x7fffffff, 4},
        {0x80000000, 0x7fffffff, 0x80000000, 4},
        {0x80000000, 0x80000000, 0x7ffffffd, 4},
        {0x80000000, 0x80000000, 0x7ffffffe, 4},
        {0x80000000, 0x80000000, 0x7fffffff, 4},
        {0x80000000, 0x80000000, 0x80000000, 4}
    };
    for(int i = 0;i < sizeof kTestCase / sizeof kTestCase[0];++i)
        if(kTestCase[i][3] != triangleType(kTestCase[i][0], kTestCase[i][1], kTestCase[i][2]))
            std::cerr<<"triangle ["<<kTestCase[i][0]<<", "<<kTestCase[i][1]
                <<", "<<kTestCase[i][2]<<"] is not "<<kTestCase[i][3]<<"\n";
}